// 发现页的接口封装
import axios from 'axios'
import store from '@/store/index.js'
import qs from 'qs'
//创建axios实例
let instance = axios.create()

// 自定义封装axios
const myaxios = {
	/**
	 * 发送get请求
	 * @param {string} url 请求资源路径
	 * @param {object} params 请求参数对象
	 */
	get(url, params) {
		return instance({
			url,
			method: 'GET',
			headers: {
				"Authorization": "sfsdf"
			},
			params
		})
	},

	/**
	 * 发生post请求
	 * @param {string} url 请求资源路径
	 * @param {object} params 请求参数对象{k:v,k2:v}
	 * @returns Promise
	 */
	post(url, params) {
		return instance({
			url,
			method: "POST",
			headers: {
				"Authorization": "sfsdf"
			},
			data: (params)
		})
	}
}

export default myaxios